package com.wish.g01.base.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wish.g01.base.dto.PremisesQueryDto;
import com.wish.g01.base.entity.TbPremisesInfo;
import com.wish.g01.base.enums.PremisesType;
import com.wish.g01.base.mapper.TbPremisesInfoMapper;
import com.wish.g01.base.service.ITbPremisesInfoService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 楼盘信息表 服务实现类
 * </p>
 *
 * @author hao
 * @since 2022-05-24
 */
@Service
public class TbPremisesInfoServiceImpl extends ServiceImpl<TbPremisesInfoMapper, TbPremisesInfo> implements ITbPremisesInfoService {

    @Override
    public List<TbPremisesInfo> searchList(PremisesQueryDto premisesQueryDto) {

        return getBaseMapper().searchList(premisesQueryDto);
    }

    /**
     * 物业类型
     */
    @Override
    public List<Map<String, Object>> getPremisesTypeList() {
        List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
        for (PremisesType c : PremisesType.values()) {
            Map<String,Object> map = new HashMap<String,Object>();
            map.put("id",c.getIndex());
            map.put("name", c.getName());
            list.add(map);
        }
        return list;
    }
}
